<template>
  <div>
    <el-form :inline="true" :model="outpatients" class="demo-form-inline">
      <el-input style="width: 300px" prefix-icon="el-icon-search" placeholder="请输入就诊卡号" v-model="outpatients.mid"></el-input>
      <el-form-item>
        <el-button type="primary" @click="getOutpatientsRecordsByMid">查询</el-button>
      </el-form-item><br>
    </el-form>

    <el-table
        :data="outpatientsRecords"
        stripe
        style="width: 100%">
      <el-table-column
          prop="id"
          label="就诊id"
          width="120">
      </el-table-column>
      <el-table-column
          fixed="left"
          prop="mid"
          label="就诊卡号"
          width="150">
      </el-table-column>
      <el-table-column
          prop="diagnosis"
          label="诊断结果"
          width="300">
      </el-table-column>
      <el-table-column
          prop="chiefComplaint"
          label="主诉"
          width="300">
      </el-table-column>
      <el-table-column
          prop="advice"
          label="医嘱"
          width="300">
      </el-table-column>
      <el-table-column
          prop="finallyTime"
          label="完成就诊时间"
          width="300">
      </el-table-column>
      <el-table-column prop="enabled" label="就诊状态" width="120" fixed="right">
        <template #default="scope">
          <el-tag v-if="scope.row.enabled" type="success">已就诊</el-tag>
          <el-tag v-else type="danger">未就诊</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="backStatus" label="退号状态" width="120" fixed="right">
        <template #default="scope">
          <el-tag v-if="scope.row.backStatus" type="danger">已退号</el-tag>
          <el-tag v-else type="success">未退号</el-tag>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "OutpatientsRecord",
  data(){
    return{
      outpatientsRecords:[],
      outpatients:{
        mid:''
      },


    }
  },
  mounted() {
    this.initAllOutpatientsRecords();
  },
  methods:{

    //获取所有就诊记录
    initAllOutpatientsRecords(){
      this.getRequest("/outpatients/getAllOutpatientsRecords").then(resp=>{
        if(resp){
          this.outpatientsRecords=resp;
        }
      })
    },
    //根据就诊卡号获取就诊记录
    getOutpatientsRecordsByMid(){
      this.getRequest("/outpatients/getRecords?mid="+this.outpatients.mid).then(resp=>{
        if(resp){
          this.outpatientsRecords=resp;
        }
      })
    },
    //删除操作员信息
    handleDelete(index,data) {
      this.$confirm('是否继续进行退号操作, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {

      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消退号'
        });
      });
    },
  }
}
</script>

<style scoped>

</style>